package cn.heapstack.jpa.entityrelationships.domain;

import java.util.Collection;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;

@Entity(name="EntityRelationships_Ship")
public class Ship {
	private int id;
	private String name;
	private Collection<Cabin> cabins;
	/**
	 * tonnage ['tʌnidʒ] 
n. 吨位(登记吨位,军舰排水量,每吨货的运费)
	 */
	private double tonnage;
	
	public Ship()
	{
		
	}
	public Ship(String name, double tonnage) {
		this.name = name;
		this.tonnage = tonnage;
	}

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public double getTonnage() {
		return tonnage;
	}
	public void setTonnage(double tonnage) {
		this.tonnage = tonnage;
	}
	
	@OneToMany(mappedBy="ship")
	public Collection<Cabin> getCabins() {
		return cabins;
	}
	public void setCabins(Collection<Cabin> cabins) {
		this.cabins = cabins;
	}

}
